<?php

use Illuminate\Support\Facades\Route;

// 因为权限验证问题所以不允许这里直接使用闭包 否则会报错； str_contains

Route::any('test', [\App\Http\Controllers\System\TestController::class,'test']);

Route::prefix('register')->group(function (){
    Route::post('phone',[\App\Http\Controllers\Customers\CustomersController::class,'phone_register']);
    Route::post('account',[\App\Http\Controllers\Customers\CustomersController::class,'account_register']);
});

Route::prefix('customers')->group(function (){
    Route::post('signDate',[\App\Http\Controllers\Customers\CustomersController::class,'signDate']);
    Route::post('login',[\App\Http\Controllers\Login\CustomersLoginController::class,'login']);
    Route::get('uPu',[\App\Http\Controllers\Login\CustomersLoginController::class,'getUserPuKey']);
    Route::get('current',[\App\Http\Controllers\Customers\CustomersController::class,'getCurrentUser']);
    // 我的地址
    Route::get('address',[\App\Http\Controllers\Address\AddressController::class,'getCurrentAddress']);
    Route::post('address',[\App\Http\Controllers\Address\AddressController::class,'create']);
    Route::post('setDefaultAddress/{addressId}',[\App\Http\Controllers\Address\AddressController::class,'setDefaultAddress']);
    Route::post('fakeDelete/{addressId}',[\App\Http\Controllers\Address\AddressController::class,'fakeDelete']);
    Route::post('update/{addressId}',[\App\Http\Controllers\Address\AddressController::class,'update']);
});

Route::prefix('wx')->group(function (){
    Route::post('login',[\App\Http\Controllers\Wx\WxAppletController::class,'wxLogin']);
});

Route::prefix('sys')->group(function (){;
    Route::get('dPu',[\App\Http\Controllers\System\ConfigController::class,'getConfigPuKey']);
    Route::post('upload',[\App\Http\Controllers\System\UploadController::class,'upload']);
    Route::post('download/{fileId}',[\App\Http\Controllers\System\UploadController::class,'download']);
    Route::get('chatCaptcha',[\App\Http\Controllers\System\CaptchaController::class,'getChatCaptcha']);
    // mapping
    Route::get('dataMapping',[\App\Http\Controllers\System\DataMappingController::class,'getList']);
});

Route::prefix('gst')->group(function(){
    Route::get('select',[\App\Http\Controllers\Goods\ManageGoodsTypeController::class,'getSelect']);
    Route::get('selectPage',[\App\Http\Controllers\Goods\ManageGoodsTypeController::class,'getSelectHasPage']);
});

Route::prefix('goods')->group(function (){
    Route::get('list_v1',[\App\Http\Controllers\Goods\GoodsController::class,'getGoodsListV1']);
    Route::get('list_v2',[\App\Http\Controllers\Goods\GoodsController::class,'getGoodsListV2']);
    Route::get('info/{goods_id}',[\App\Http\Controllers\Goods\GoodsController::class,'getInfo']);
    Route::post('addCart',[\App\Http\Controllers\Goods\CartItemsController::class,'create']);

    Route::post('addCart',[\App\Http\Controllers\Goods\CartItemsController::class,'create']);
    Route::post('delCart/{id}',[\App\Http\Controllers\Goods\CartItemsController::class,'fakeDelete']);

});

Route::prefix('orders')->group(function (){
   Route::post('create',[\App\Http\Controllers\Order\UserOrderController::class,'create']);
   Route::get('list',[\App\Http\Controllers\Order\UserOrderController::class,'getList']);
   Route::post('delete/{ids}',[\App\Http\Controllers\Order\UserOrderController::class,'fakeDeleteByIds']);
});
